<?php
if (! defined('BASEPATH'))
    exit('No direct script access allowed');

class CT_Form_validation extends CI_Form_validation
{

    public function __construct($rules=[])
    {
        parent::__construct($rules);
        $this->set_error_delimiters('', '');
    }

    public function index($str)
    {
        if (preg_match("/^[0-9a-z-]/is", $str)) {
            return true;
        }
        return false;
    }

    /**
     * 设置表单错误
     *
     * @param string $msg            
     */
    public function set_field_error($field, $msg)
    {
        $this->_field_data[$field]['error'] = $msg;
    }
}
?>